import api from "@/libs/request";

/**
 * 获取积分商品
 * @param data
 */
export const getIntegralGoods = (data: any) => {
  return api.get("/integral/manager/get/integralGoods/List", data);
};

/**
 * 发布积分商品
 * @param data
 */
export const putIntegralGoods = (data: any) => {
  return api.post(`/integral/manager/issue/integralGoods`, data);
};

/**
 * 删除积分商品
 * @param data
 */
export const delIntegralGoods = (ids, data: any) => {
  return api.delete(
    `/integral/manager/delete/batch/integralGoods/${ids}`,
    data,
  );
};

/**
 * 获取积分商品详情
 * @param data
 */
export const getIntegralGoodsDetail = (data: any) => {
  return api.get(`/integral/manager/get/integralGoodsInfo`, data);
};

/**
 * 编辑积分商品详情
 * @param data
 */
export const editIntegralGoodsDetail = (data: any) => {
  return api.put(`/integral/manager/update/integralGoods`, data);
};

/**
 * 上下架积分商品
 * @param data
 */
export const upDownIntegralGoods = (status, data: any) => {
  return api.put(`/integral/manager/update/batchIntegralGoods/${status}`, data);
};

/**
 * 控制积分商城开启关闭状态
 * @param data
 */
export const takeOnOff = (data: any) => {
  return api.get(`/integral/manager/shop/update/status`, data);
};

/**
 * 获得积分规则
 * @param data
 */
export const integralRule = (data: any) => {
  return api.get(`integral/rule/get`, data);
};

/**
 * 积分规则修改
 * @param data
 */
export const integralRuleUpdate = (data: any) => {
  return api.put(`integral/rule/update`, data);
};

/**
 * 查询积分优惠券订单
 */
export const integralCouponOrder = (data: any) => {
  return api.get(
    `integral/manager/integralCouponOrder/get/integralCouponOrder`,
    data,
  );
};

/**
 * 积分订单批量备注功能
 */
export const remarkIntegralCouponOrder = (data: any) => {
  return api.put(
    `integral/manager/integralCouponOrder/update/orderRemark`,
    data.ids,
    { params: data },
  );
};

/**
 * 查询积分订单
 */
export const integralOrder = (data: any) => {
  return api.get(`integral/manager/integralOrder/get/integralOrder`, data);
};

/**
 * 查询单个积分订单
 */
export const integralOrderById = (data: any) => {
  return api.get(`integral/manager/integralOrder/get/integralOrderInfo`, data);
};

/**
 * 修改单个积分订单
 */
export const updateIntegralOrderById = (data: any) => {
  return api.put(`integral/manager/integralOrder/update/ReceivingInfo`, data);
};

/**
 * 积分订单批量备注
 */
export const integralRemarkOrder = (data: any) => {
  return api.put(
    `integral/manager/integralOrder/update/orderRemark`,
    data.integralOrders,
    { params: data },
  );
};

/**
 * 积分订单确认收货
 */
export const integralOrderSure = (data: any) => {
  return api.put(`integral/manager/integralOrder/receive`, data);
};

/**
 * 积分订单发货
 */
export const sendOneintegralGood = (data: any) => {
  return api.put(`integral/manager/integralOrder/orderDelivery`, data);
};

/**
 * 积分订单打印发货
 */
export const sendintegralGoodByPrint = (data: any) => {
  return api.post(`logistics/print/deliver/integralOrder`, data);
};

/**
 * 获取待发货积分订单
 */
export const getSendorder = (data: any) => {
  return api.get(`integral/manager/integralOrder/goodsOrder/filtrate`, data);
};

/**
 * 积分订单物流信息
 */
export const integralGoodLogMsg = (data: any) => {
  return api.get(`integral/manager/integralOrder/traces/info`, data);
};

/**
 * 积分扣除
 */
export const deleteIntegral = (data: any) => {
  return api.put(`/integral/detail/deduct`, data, {
    headers: {
      "Content-Type": "application/json",
    },
  });
};

/**
 * 积分充值
 */
export const rechargeIntegral = (data: any) => {
  return api.put(`/integral/detail/recharge`, data, {
    headers: {
      "Content-Type": "application/json",
    },
  });
};

/**
 *
 * pc端积分明细获取
 */
export const getIntegralDetail = (data: any) => {
  return api.get(`integral/detail/gain/detail`, data);
};

/**
 * 积分修改
 */
export const changeIntegral = (data: any) => {
  return api.put(`integral/detail/change`, data.userIds, {
    params: data,
  });
};
